<!-- 列表显示头 开始 -->
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="STYLE1" bgcolor="b5d6e6">
  <tr>
    <td colspan="3" align="left" background='<%=$urr+"skin/images/bg.gif"%>'><img src='<%=$urr+"skin/icon/list.gif"%>' width="16" height="16" />
      <span class="STYLE3"><%=@titles %></span></td>
  </tr>
</table>
<!-- 列表显示头 结束 -->

<!-- 列表查询项 开始 -->
<table width="100%" border="0" cellpadding="2" cellspacing="2" class="STYLE1">
  <% form_for :ad, :url => { :action => "list" } do |f| %>
    <tr>
      <td height="30" align="left">
        <%= f.label "广告名称" %>
        <%= f.text_field :name%>
        <%= f.submit '搜索' %>
      </td>
    </tr>
  <% end %>
</table>
<!-- 列表查询项 结束 -->

<!-- 列表操作项 开始 -->
<table width="100%" border="0" cellpadding="2" cellspacing="2" class="STYLE1"> 
  <tr>
    <td height="30" align="right">
      <%= button_to "增加广告", :controller => "ad",:action => "new" %>
    </td>
  </tr>
</table>
<!-- 列表操作项 结束 -->


<!-- 列表数据项 开始 -->
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="b5d6e6"  class="STYLE1">
  <tr>
    <td width="10%" height="22" align="center" bgcolor="#33FFFF">名称</td>
    <td width="5%" align="center" bgcolor="#33FFFF">URL</td>
    <td width="5%" align="center" bgcolor="#33FFFF">位置</td>
    <td width="5%" align="center" bgcolor="#33FFFF">状态</td>
    <td width="5%" align="center" bgcolor="#33FFFF">X</td>    
    <td width="5%" align="center" bgcolor="#33FFFF">描述</td>
    <td width="15%" align="center" bgcolor="#33FFFF">更新时间</td>
    <td width="30%" align="center" bgcolor="#33FFFF" class="STYLE1">操作</td>
  </tr>
  <% @ads.each_with_index do |ad,index| %>
    <%
    bg_col = "#CCFFCC"
    unless index%2 == 0
      bg_col = "#FFCCCC"
    end
  %>
    <tr>
      <td align="center" bgcolor=<%= bg_col %>>
        <%=h ad.name %>
      </td>
      <td align="center" bgcolor=<%= bg_col %>>
        <%=h ad.url %>
      </td>
      <td align="center" bgcolor=<%= bg_col %>>
        <% if ad.orders == 1 %>
          <%="首页广告" %>
        <% elsif ad.orders == 2 %>
          <%="栏目广告" %>
        <% elsif ad.orders == 3 %>
          <%="资源广告" %>
        <%else%>
          <%="固定广告" %>
        <% end %>        
      </td>
      <td align="center" bgcolor=<%= bg_col %>>
        <% if ad.status == '1' %>
          <%="开放" %>
        <% else %>
          <%="关闭" %>
        <% end %>
      </td>
      <td align="center" bgcolor=<%= bg_col %>><%=h ad.x %></td>      
      <td align="center" bgcolor=<%= bg_col %>><%=h ad.desc %></td>
      <td align="center" bgcolor=<%= bg_col %>>
        <%=h ad.updated_at.strftime("%Y-%m-%d %H:%M:%S") %>
      </td>
      <td align="center" bgcolor=<%= bg_col %>>
        <%= link_to '查看',  :controller => "ad", :action => "show", :id => ad.id %>
        <%= link_to '编辑',  :controller => "ad", :action => "edit", :id => ad.id  %>
        <%#= link_to '删除',  :controller => "ad", :action => "delete", :id => ad.id  %>
        <%= "删除" %>
      </td>
    </tr>
  <% end %>
</table>
<!-- 列表数据项 结束 -->

<!-- 列表分页项 开始 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr align="center">
    <td align="center" height="40">
      <%= will_paginate @ads, :style => 'font-size: small'%>
    </td>
  </tr>
</table>
<!-- 列表分页项 结束 -->